package com.cetccloud.ap.proxy.channel.cossDomain.s30;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @ClassName S30Config
 * @Description
 * @Author superz
 * @Date 2021/4/23 14:49
 * @Version 1.0
 **/
@Data
@Configuration
@ConfigurationProperties(prefix = "s30")
public class S30Config {

    @Autowired
    private ServerProperties serverProperties;

    @PostConstruct
    private void init() {
        this.proxy.setAppPort(serverProperties.getPort());
    }

    private Peer peer;

    private Proxy proxy;

    @Data
    public static class Peer {
        private Send send;
        private Recv recv;
    }

    @Data
    public static class Send {
        private String ip;
        private String port;
    }

    @Data
    public static class Recv {
        private String ip;
        private String port;
    }

    @Data
    public static class Proxy {
        private Boolean autoRegister = false;
        private String zoneId;
        private String appId;
        private String respFlag;
        private String sec;
        private String appName;
        private String appAlias;
        private String appIp;
        private Integer appPort;
    }
}
